package com.yungu.swift.api.route.v2.driver;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yungu.swift.api.base.BaseApi;
import com.yungu.swift.base.ResponseData;
import com.yungu.swift.order.model.param.JoinOrderParam;
import com.yungu.swift.order.service.OrderJoinService;
import com.yungu.swift.order.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(value = "/api/v2/driver/")
@Api(value = "【司机】【订单】【跨城小件】司机跨城小件订单接口", tags = "司机订单相关操作")
public class DriParcelOrderApi extends BaseApi {

    @Reference
    private OrderJoinService orderJoinService;

    @RequestMapping(value = {"/token/join/order/parcel/getAllReceiptCode"})
    @ApiOperation(value = "司机获取收件码接口", response = ResponseData.class)
    public ResponseData<List<Map<String, Object>>> getAllReceiptCode(@RequestHeader String appid, @RequestBody JoinOrderParam joinOrdeParam) {
        joinOrdeParam.setAppid(appid);
        return orderJoinService.getReceiptCode(joinOrdeParam);
    }

    @RequestMapping(value = {"/token/join/order/parcel/confirmReceiptCode"})
    @ApiOperation(value = "司机确认收件码接口", response = ResponseData.class)
    public ResponseData<Boolean> confirmReceiptCode(@RequestHeader String appid, @RequestBody JoinOrderParam joinOrdeParam) {
        joinOrdeParam.setAppid(appid);
        return orderJoinService.confirmReceiptCode(joinOrdeParam);
    }
}
